/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.modelo;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author USER
 */
@Entity
@Table(name = "MULTIMEDIA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MultimediaP.findAll", query = "SELECT m FROM MultimediaP m"),
    @NamedQuery(name = "MultimediaP.findByContenido", query = "SELECT m FROM MultimediaP m WHERE m.contenido = :contenido"),
    @NamedQuery(name = "MultimediaP.findByTipo", query = "SELECT m FROM MultimediaP m WHERE m.tipo = :tipo"),
    @NamedQuery(name = "MultimediaP.findAllImages", query = "SELECT m FROM MultimediaP m WHERE m.idInmueble = :id AND m.tipo='I'"),
    @NamedQuery(name = "MultimediaP.findVideo", query="SELECT m FROM MultimediaP m WHERE m.idInmueble = :id AND m.tipo='V'"),
    @NamedQuery(name = "MultimediaP.findByIdMultimedia", query = "SELECT m FROM MultimediaP m WHERE m.idMultimedia = :idMultimedia")})
public class MultimediaP implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "CONTENIDO")
    private String contenido;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "TIPO")
    private String tipo;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_MULTIMEDIA")
    private BigDecimal idMultimedia;
    @JoinColumn(name = "ID_INMUEBLE", referencedColumnName = "ID_INMUEBLE")
    @ManyToOne(optional = false)
    private InmuebleP idInmueble;

    public MultimediaP() {
    }

    public MultimediaP(BigDecimal idMultimedia) {
        this.idMultimedia = idMultimedia;
    }

    public MultimediaP(BigDecimal idMultimedia, String contenido, String tipo) {
        this.idMultimedia = idMultimedia;
        this.contenido = contenido;
        this.tipo = tipo;
    }

    public String getContenido() {
        return contenido;
    }

    public void setContenido(String contenido) {
        this.contenido = contenido;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public BigDecimal getIdMultimedia() {
        return idMultimedia;
    }

    public void setIdMultimedia(BigDecimal idMultimedia) {
        this.idMultimedia = idMultimedia;
    }

    public InmuebleP getIdInmueble() {
        return idInmueble;
    }

    public void setIdInmueble(InmuebleP idInmueble) {
        this.idInmueble = idInmueble;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idMultimedia != null ? idMultimedia.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MultimediaP)) {
            return false;
        }
        MultimediaP other = (MultimediaP) object;
        if ((this.idMultimedia == null && other.idMultimedia != null) || (this.idMultimedia != null && !this.idMultimedia.equals(other.idMultimedia))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.modelo.MultimediaP[ idMultimedia=" + idMultimedia + " ]";
    }
    
}
